package com.ccz.demo.design.subscribe;

import com.ccz.demo.design.subscribe.javautil.Observe;
import com.ccz.demo.design.subscribe.javautil.Subject;

/**
 * @ClassName Test
 * @Author caihaoyun
 * @Date 2020/4/2
 * @Version V1.0
 **/
public class Test {


    public static void main(String[] args) {
//        ConcreteSubject star = new ConcreteSubject();
//
//        ActObserver a1 = new ActObserver("a1");
//        ActObserver a2 = new ActObserver("a2");
//        ActObserver a3 = new ActObserver("a3");
//        ActObserver a4 = new ActObserver("a4");
//
//        star.addFans(a1);
//        star.addFans(a2);star.addFans(a3);star.addFans(a4);
//        star.notify("ccz来了来了");

        Subject subject = new Subject();

        Observe b1 = new Observe();
        Observe b2 = new Observe();

        subject.addObserver(b1);
        subject.addObserver(b2);

        subject.setMessage("====msg");
        System.out.println(b1.getMyMsg());
        System.out.println(b2.getMyMsg());
    }

}
